﻿@model IEnumerable<Dqaqs.Data.Project>

@{
    ViewBag.Title = "DQAQS - List of Project";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using (Html.BeginForm())
{
<fieldset>
<legend>List of Projects</legend>
<table border="0" cellspacing="0">
    <tr>
        <th>
            Project Title
        </th>
        <th></th>
    </tr>
@foreach (var item in Model)
{
    <tr class="@(
 (Session["_Project"] != null && ((Project)Session["_Project"]).Id.Equals(item.Id))
                ? "selected-table-item" : "table-item")">
        <td style="width: 300px; padding:5px">
                    @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td style="padding:5px">
            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Detail", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { id = item.Id, onclick="confirmDeletion('" + item.Id + "'); return false;" }) |
            @Html.ActionLink("Select", "Select", new { id = item.Id })
        </td>
    </tr>
}
</table>
    </fieldset>
}

<div id="delete-confirmation" style="visibility:hidden">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>

<script language="javascript" type="text/javascript">
    function confirmDeletion(id) {
        $("#delete-confirmation").css("visibility", "visible");
        $("#delete-confirmation").dialog(
        {
            width: 400,
            height: 200,
            modal: true,
            title: "Warning",
            resizable: false,
            buttons: {
                "Delete": function () { window.location.href = "Project/Delete/" + id; $(this).dialog("close"); },
                "Cancel": function () { $(this).dialog("close"); }
            }
        }
        );
	}
	$(function() {
		$( "input:submit, a, button", ".demo" ).button();
		$( "a", ".demo" ).click(function() { return false; });
	});
</script>